<!doctype html>
<html lang="en">

	<head>
		<meta charset="UTF-8" />
		<title>Document</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../css/mui.css" />
		<link rel="stylesheet" type="text/css" href="../css/reg.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">注册</h1>
		</header>

		<div class="mui-input-group">
			<div class="mui-input-row">
				<label>用户名</label>
				<input type="text" class="mui-input-clear" placeholder="请输入用户名" id="username" value="xxx">
			</div>
			<div class="mui-input-row">
				<label>密码</label>
				<input type="password" class="mui-input-clear mui-input-password" placeholder="请输入密码" id="pwd" value="123">
			</div>
			<div class="mui-input-row">
				<label>确认</label>
				<input type="password" class="mui-input-clear mui-input-password" placeholder="请确认密码" id="confirm" value="123">
			</div>
		</div>
		</div>

		<div class="mui-input-row" id="btn">

			<input type="button" class="mui-input-clear mui-input-password" value="注册">
		</div>
		</div>

		<script src="../js/mui.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../js/jquery3.2.js"></script>

		<script type="text/javascript">
			mui.init()

//			mui.plusReady(function() {
				var username = $('#username').val();
				var pwd = $('#pwd').val();
				var confirm = $('#confirm').val();

				$('#btn').click(function() {
					
					if(username && pwd && confirm) {
					
//						var img = new Image();
//						img.src = 'img/head.jpg';
                     var canvas  = $('<canvas></canvas>')[0];
                     console.log(canvas);
                     canvas.width = 200;
                     canvas.height = 300;
                   var pen =  canvas.getContext('2d');
                   
                   pen.beginPath();
                     pen.rect(0,0,50,50);
                     pen.stroke();
						var base64 = canvas.toDataURL();
						console.log(base64);
			
						$.get('http://10.20.159.92:3000/reg', {username:username,pwd:pwd,images:base64}, function(res) {
							console.log(111)
							if(res && res.code == 0) {
								console.log(res);
								location.href = 'login.html';
							}
						},'json')

					}
				})

//			})
		</script>
	</body>

</html>